package com.atguigu.ggkt.vod.controller;

import com.atguigu.ggkt.response.Result;
import com.atguigu.ggkt.vod.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author zfj
 * @date 2022/7/9 -9:17
 */
@Api(tags = "文件上传接口")
@RestController
@RequestMapping("/admin/vod/file")
public class FileUploadController {
	@Autowired
	private FileService fileService;
	/**
	 * 文件上传
	 */
	@ApiOperation(value = "文件上传")
	@PostMapping("/upload")
	public Result upload(
			@ApiParam(name = "file", value = "文件", required = true)
			@RequestParam("file") MultipartFile file) {
		String uploadUrl = fileService.upload(file);
		return Result.ok(uploadUrl).message("文件上传成功");
	}
}
